package com.yundong.gongchengji.ui.my.activity;

import android.os.Bundle;
import android.view.View;
import android.widget.ListView;

import com.yundong.gongchengji.R;
import com.yundong.gongchengji.adapter.CommonAdapter;
import com.yundong.gongchengji.adapter.ViewHolder;
import com.yundong.gongchengji.base.BaseActivity;

import java.util.ArrayList;
import java.util.List;

/**
 * 我的银行卡
 * Created by ls on 2017/2/21.
 */

public class BankcardActivity extends BaseActivity implements View.OnClickListener{
    private ListView listviewCard;
    private CommonAdapter commonAdapter;
    @Override
    public int getContentViewId() {
        return R.layout.activity_bankcard;
    }

    @Override
    protected void initView(Bundle savedInstanceState) {
        setLeft();
        setTitle("我的银行卡");
        setRight(this,R.mipmap.ic_launcher);
        listviewCard= (ListView) findViewById(R.id.listview_card);
    }

    @Override
    protected void initVariable() {
        final List<String> list=new ArrayList<String>();
        list.add(1+"");
        list.add(2+"");
        list.add(3+"");
        commonAdapter=new CommonAdapter(BankcardActivity.this,list,R.layout.item_bankcard) {
            @Override
            public void convert(ViewHolder helper, Object item, final int position) {

                View view= helper.getView(R.id.linear_delete);
                view.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        list.remove(position);
                        commonAdapter.notifyDataSetChanged();
                    }
                });
            }
        };
        listviewCard.setAdapter(commonAdapter);
    }

    @Override
    protected void processLogic(Bundle savedInstanceState) {

    }

    @Override
    public void onClick(View view) {

    }
}
